/* ====================================== toast  ====================================== */
import React from 'react'
// ===================================================================== image
import DefImage from './svg/def-img'
// ===================================================================== 
const _ = ({ src, width = '100%', height, style, className, onClick, alt, round, size = '100%', wrap, network, full }) => {
	const wrapStyle = {width,height }
	const imgStyle = {width,height, maxWidith:'100%', ...style}
	const _alt = alt || ''
	if( src && src.indexOf('http') === -1 && network){
		src = window.$fn.getImagePrefix(src)
	}
	let img = <img draggable={false} onClick={onClick} className={`${className||''} ${round?'r100px':''}`} style={imgStyle} src={src} alt={_alt}/>
	if(wrap){
		img = (
			<div className={`${className||''} ${round?'r100px':''} rel fxmc`} style={wrapStyle} onClick={onClick}>
				{ src ? img : <DefImage size={size} />}
			</div>
		)
	}
	if(wrap){
		return img
	}else{
		return src ? img : <div className={`fxmc ${full?'wh':''}`}><DefImage size={size} /></div>
	}
}

export default _